/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package networkrespnse;

import core.ParameterDecoder;
import utils.Utils;
/**
 *
 * @author Kvest
 */
public class CallSignChangedResponse extends Response
{
    private int orderID;
    private String newCallSign;

    public CallSignChangedResponse(byte[] data)
    {
        super(CALL_SIGNCHANGED_RESPONSE);
        orderID = -1;
        newCallSign = "";
        
        parse(data);
    }

    protected void parse(byte[] data)
    {
        byte[] temp,body;
        int index,size;
        body = ParameterDecoder.getTransferBody(data);
        //������������� ��������
        temp = new byte[4];
        index = 0;
        for (int i=0;i<4;i++)
        {
                temp[i] = body[index++];
        }
        index += Utils.byteToInt(temp);
        //������ �������� - OrderID
        for (int i=0;i<4;i++)
        {
                temp[i] = body[index++];
        }
        orderID = Utils.byteToInt(temp);

        //������ �������� - NewCallSign
        for (int i=0;i<4;i++)
        {
            temp[i] = body[index++];
        }
        size = Utils.byteToInt(temp);
        temp = new byte[size];
        for (int i=0;i<size;i++)
        {
                temp[i] = body[index++];
        }
        newCallSign = Utils.byteToString(temp);
    }

    public int getOrderID()
    {
        return orderID;
    }

    public String getNewCallSign()
    {
        return newCallSign;
    }
}
